import { waitFor } from '@/lib/helper/waitFor'
import prisma from '@/lib/prisma'
import React from 'react'
import Editor from '../../_components/Editor'

async function Page({ params }: { params: { workflowId: string } }) {
    const { workflowId } = await params

    // const {userId} = auth()
    // if (!userId) {
    // return <div>unauthenticated</div>
    // }
    const userId = "test"

    // await waitFor(5000)

    const workflow = await prisma.workflow.findUnique({
        where: {
            id: workflowId,
            userId
        }
    })

    if (!workflow) {
        return <div>Workflow not found</div>
    }
    return (
        <Editor workflow={workflow} />
    )
}

export default Page